#include "widget.h"
#include "ui_widget.h"
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->lcdNumber->display(10);

//    connect(&thread,&Thread::notify,this,&Widget::handler);
//    connect(&thread,&Thread::notify,this,[=](){
//        int val = ui->lcdNumber->intValue() - 1;
//        ui->lcdNumber->display(val);
//    });


    thread.start();
    thread2.start();

    thread.wait();
    thread2.wait();

    qDebug() << Thread::num;

}

Widget::~Widget()
{
    delete ui;
}

void Widget::handler()
{
    int val = ui->lcdNumber->intValue() - 1;
    ui->lcdNumber->display(val);

}

